Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Farras Andriawan #7

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Farras Andriawan #7

wants to merge 5 commits into from

Conversation

fatau2
Copy link

@fatau2 fatau2 commented Sep 9, 2019

Added CSS

axios({
method: 'GET',
url: 'http://localhost:3000/posts/'
}).then((response)=>{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

catch tetap perlu di handle

axios({
method: 'DELETE',
url: 'http://localhost:3000/posts/' + post._id,
}).then(res =>{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

catch tetap perlu di handle jika error

<form v-show="showForm" id="article-form">
<label>Article title</label><br>
<input type="text" name="title" id="form-title" v-model="form.title"><br>
<p>{{form.description}}</p>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tidak perlu di tampilkan disini state nya form description etc

createdAt: new Date()
}
}).then(()=>{
console.log('success')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

habis selesai submit di handle pesan sukses / errornya && form di reset dan ditutup kembali

app.submitData();
})
*/
$('#btn-update-article').click(function(event){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kalo udah pake vue jquery untuk handle event tidak perlu dilakukan lagi

@dhimashary
Copy link

diselesaikan lagi ya kalo sudah sehat

}

static delete(req,res){
Post.findByIdAndDelete({_id : req.params.id}).then(()=>{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentasi then catch perlu dirapihin lagi

post
})
}).catch((error)=>{
message : "failed adding post",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hasil error gak dikirim balik ke client

Post.find().then((posts)=>{
res.json(posts)
}).catch((err)=>{
console.log(err)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jgn cuman console.log

type : String,
required : true
},
createdAt: Date

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ada opsi timestamps true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants